From: Keir Fraser Date: Wed, 9 Feb 2011 08:40:05 +0000 (+0000) Subject: [VTD][QUIRK] add spin lock across snb pre/postamble functions X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10801 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=f4b185362da47e1d9189ed3eb73cd8eca80c364e;p=xen.git [VTD][QUIRK] add spin lock across snb pre/postamble functions Added a spinlock across snb_vtd_ops_preamble() and snb_vtd_ops_postamble() to make modifications to IGD registers atomic. Continue keeping snb_igd_quirk default off. Signed-off-by: Allen Kay --- diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c index ef6c8d0f29..0f7db71443 100644 --- a/xen/drivers/passthrough/vtd/quirks.c +++ b/xen/drivers/passthrough/vtd/quirks.c @@ -55,6 +55,7 @@ bool_t rwbf_quirk; static int is_cantiga_b3; static int is_snb_gfx; static u8 *igd_reg_va; +static spinlock_t igd_lock; /* * QUIRK to workaround Xen boot issue on Calpella/Ironlake OEM BIOS @@ -98,6 +99,7 @@ static void cantiga_b3_errata_init(void) static void snb_errata_init(void) { is_snb_gfx = IS_SNB_GFX(igd_id); + spin_lock_init(&igd_lock); } /* @@ -225,7 +227,12 @@ void vtd_ops_preamble_quirk(struct iommu* iommu) { cantiga_vtd_ops_preamble(iommu); if ( snb_igd_quirk ) + { + spin_lock(&igd_lock); + + /* match unlock in postamble */ snb_vtd_ops_preamble(iommu); + } } /* @@ -234,7 +241,12 @@ void vtd_ops_preamble_quirk(struct iommu* iommu) void vtd_ops_postamble_quirk(struct iommu* iommu) { if ( snb_igd_quirk ) + { snb_vtd_ops_postamble(iommu); + + /* match the lock in preamble */ + spin_unlock(&igd_lock); + } } /* initialize platform identification flags */